<?php
use tpfcore\Core;
?>
<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <!-- Set render engine for 360 browser -->
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- HTML5 shim for IE8 support of HTML5 elements -->
    <!--[if lt IE 9]>
		<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js">
		</script>
	<![endif]-->
    <link href="{$admin_assets_path}/css/theme.min.css" rel="stylesheet">
    <link href="{$admin_assets_path}/css/simplebootadmin.css" rel="stylesheet">
    <link href="{$admin_assets_path}/css/default.css" rel="stylesheet" />
    <link href="{$admin_assets_path}/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <style>
    .length_3 {
        width: 180px;
    }

    form .input-order {
        margin-bottom: 0px;
        padding: 3px;
        width: 40px;
    }

    .table-actions {
        margin-top: 5px;
        margin-bottom: 5px;
        padding: 0px;
    }

    .table-list {
        margin-bottom: 0px;
    }
    </style>
    <!--[if IE 7]>
		<link rel="stylesheet" href="{$admin_assets_path}/css/font-awesome-ie7.min.css">
	<![endif]-->
    <script type="text/javascript">
    //全局变量
    var GV = {
        WEB_ROOT: "",
        DIMAUB: "/",
        JS_ROOT: "/theme/backend/assets/js/",
        TOKEN: ""
    };
    </script>
    <!-- Le javascript==================================================-
	-> <!-- Placed at the end of the document so the pages load faster -->
    <script src="{$admin_assets_path}/js/jquery.js"></script>
    <script src="{$admin_assets_path}/js/wind.js"></script>
    <script src="{$admin_assets_path}/js/bootstrap.min.js"></script>
    <link href="{$admin_assets_path}/kindeditor/themes/default/default.css" rel="stylesheet" />
    <script src="{$admin_assets_path}/kindeditor/kindeditor-min.js"></script>
    <script>
    var editor;
    KindEditor.ready(function(K) {
        var uploadbutton = K.uploadbutton({
            button: K('#uploadButton')[0],
            fieldName: 'imgFile',
            url: "{:url('mall/GoodsType/upload')}",
            afterUpload: function(data) {
                if (data.code === 0) {
                    var url = K.formatUrl(data.data[0], 'absolute');
                    K('#logo').val(url);
                    $('#show_thumb').attr('src', url).show();
                } else {
                    alert(data.msg);
                }
            },
            afterError: function(str) {
                alert('错误信息已打印到控制台');
                console.log(str);
            }
        });
        uploadbutton.fileBox.change(function(e) {
            uploadbutton.submit();
        });
    });
    </script>
</head>

<body>
    <div class="wrap">
        <ul class="nav nav-tabs">
            <li><a href="{:url('mall/GoodsType/index')}">商品类型管理</a></li>
            {empty name="list"}
            <li class="active"><a href="{:url('mall/GoodsType/add')}">添加商品类型</a></li>
            {else/}
            <li><a href="{:url('mall/GoodsType/add')}">添加商品类型</a></li>
            <li class="active"><a href="{:url('mall/GoodsType/add',['id'=>$list[0]->id])}">编辑商品类型</a></li>
            {/empty}
        </ul>
        <form method="post" class="form-horizontal js-ajax-form" action="">
        	{notempty name="list"}
        	<input type="hidden" name="id" value="{$list[0]->id}" />
        	{/notempty}
            <fieldset>
                <div class="">
                    <table class="table table-bordered">
                        <tbody>
                            <tr>
                                <th width="80">商品类型名称</th>
                                <td>
                                    <input type="text" name="name" value="{$list[0]->name|default=''}" placeholder="请输入商品类型名称"> <span class="form-required">*</span>
                                </td>
                            </tr>
       
                            <tr>
                                <th>是否启用</th>
                                <td>
                                	{empty name="list"}
                                    <label><input type="radio" name="status" value="1" checked /> 启用</label>
                                    <label><input type="radio" name="status" value="0" /> 禁用</label>
                                    {else/}
                                    <label><input type="radio" name="status" value="1" {eq name="list[0]->status" value="1"}checked{/eq}/> 启用</label>
									<label><input type="radio" name="status" value="0" {eq name="list[0]->status" value="0"}checked{/eq}/>禁用</label>
									{/empty}
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
            </fieldset>
            <div class="form-actions">
                <button class="btn btn-primary js-ajax-button" type="button">确定操作</button>
                <a class="btn" href="javascript:history.back(-1);">返回</a>
            </div>
        </form>
    </div>
    <script src="{$admin_assets_path}/js/common.js"></script>
</body>

</html>